/**
 * 
 */
package javapop.framework.generic;

import javapop.framework.generic.tool.GrammarVisitor;

/**
 * @author hakim
 *
 */
public class GExprOperand implements GrammarTree {

	private String parser;
	private GParser operand;
	
	/**
	 * @param gParser 
	 * @param string 
	 * 
	 */
	public GExprOperand(String string, GParser gParser) {
		this.parser = string;
		this.operand = gParser;
	}



	/**
	 * @return the parser
	 */
	public String getParser() {
		return parser;
	}

	/**
	 * @return the operand
	 */
	public GParser getOperand() {
		return operand;
	}

	@Override
	public <T,R,E extends Exception> T visit(GrammarVisitor<T,R, E> g) throws E {
		return g.visit(this);
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder("@expr_operand(");
		sb.append(parser);
		sb.append(",");
		sb.append(operand.toString());
		sb.append(");");
		return sb.toString();
	}
}
